package com.ruoyi.voucher.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.voucher.mapper.VoucherAttachmentMapper;
import com.ruoyi.voucher.domain.VoucherAttachment;
import com.ruoyi.voucher.service.IVoucherAttachmentService;

/**
 * 凭证附件Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-26
 */
@Service
public class VoucherAttachmentServiceImpl implements IVoucherAttachmentService 
{
    @Autowired
    private VoucherAttachmentMapper voucherAttachmentMapper;

    /**
     * 查询凭证附件
     * 
     * @param attachmentId 凭证附件主键
     * @return 凭证附件
     */
    @Override
    public VoucherAttachment selectVoucherAttachmentByAttachmentId(Long attachmentId)
    {
        return voucherAttachmentMapper.selectVoucherAttachmentByAttachmentId(attachmentId);
    }

    /**
     * 查询凭证附件列表
     * 
     * @param voucherAttachment 凭证附件
     * @return 凭证附件
     */
    @Override
    public List<VoucherAttachment> selectVoucherAttachmentList(VoucherAttachment voucherAttachment)
    {
        return voucherAttachmentMapper.selectVoucherAttachmentList(voucherAttachment);
    }

    /**
     * 新增凭证附件
     * 
     * @param voucherAttachment 凭证附件
     * @return 结果
     */
    @Override
    public int insertVoucherAttachment(VoucherAttachment voucherAttachment)
    {
        voucherAttachment.setCreateTime(DateUtils.getNowDate());
        return voucherAttachmentMapper.insertVoucherAttachment(voucherAttachment);
    }

    /**
     * 修改凭证附件
     * 
     * @param voucherAttachment 凭证附件
     * @return 结果
     */
    @Override
    public int updateVoucherAttachment(VoucherAttachment voucherAttachment)
    {
        return voucherAttachmentMapper.updateVoucherAttachment(voucherAttachment);
    }

    /**
     * 批量删除凭证附件
     * 
     * @param attachmentIds 需要删除的凭证附件主键
     * @return 结果
     */
    @Override
    public int deleteVoucherAttachmentByAttachmentIds(Long[] attachmentIds)
    {
        return voucherAttachmentMapper.deleteVoucherAttachmentByAttachmentIds(attachmentIds);
    }

    /**
     * 删除凭证附件信息
     * 
     * @param attachmentId 凭证附件主键
     * @return 结果
     */
    @Override
    public int deleteVoucherAttachmentByAttachmentId(Long attachmentId)
    {
        return voucherAttachmentMapper.deleteVoucherAttachmentByAttachmentId(attachmentId);
    }
}
